// pages/page1/page1.js

Page({

  /**
   * 页面的初始数据
   */
  data: {
    nonFlag:0,
    imgUrls: [
      {
        link: '/pages/index/index',
        url: 'http://imgsrc.baidu.com/imgad/pic/item/810a19d8bc3eb1352ca8076fac1ea8d3fc1f44f2.jpg'
      }, {
        link: '/pages/logs/logs',
        url: 'http://imgsrc.baidu.com/imgad/pic/item/810a19d8bc3eb1352ca8076fac1ea8d3fc1f44f2.jpg'
      }, {
        link: '/pages/test/test',
        url: 'http://imgsrc.baidu.com/imgad/pic/item/810a19d8bc3eb1352ca8076fac1ea8d3fc1f44f2.jpg'
      }
    ],
    indicatorDots: true,
    autoplay: true,
    interval: 5000,
    duration: 1000,
    userInfo: {},
    list:[
      { src: "food.png", title: "美食" },
      { src: "help.png", title: "使用说明" },
      { src: "underTheLine.png", title: "线下" },
      { src: "tip.png", title: "tips" },
      {src:"hot.png",title:"热门"}
    ],
    list2:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    //这里要请求数据啊
    wx.request({
      url: 'http://helpPage.yyfai.club/recommend.php?user_id=null',
      header: {
        'content-type': 'application/json' // 默认值
      },
      success(res) {
        console.log(res.data);
        that.setData({
          list2: res.data
        });
      }
    })
  },
  search(e){
    wx.redirectTo({
      url: '../search/search'
    })
  },
  click0(e){
    var id = e.currentTarget.id;
    wx.navigateTo({
      url: '../page2/page2?class=' + id
    })
  },
  navigateTo(e) {
    var id = e.currentTarget.id;
    wx.navigateTo({
      url: '../page/page?id=' + id
    })
  }
})